/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package producto.dbentities;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Kevin
 */
@Entity
@Table(name = "baj_vent_categoria")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "BajVentCategoria.findAll", query = "SELECT b FROM BajVentCategoria b"),
    @NamedQuery(name = "BajVentCategoria.findByIdbajVentCat", query = "SELECT b FROM BajVentCategoria b WHERE b.idbajVentCat = :idbajVentCat"),
    @NamedQuery(name = "BajVentCategoria.findByCategoria", query = "SELECT b FROM BajVentCategoria b WHERE b.categoria = :categoria")})
public class BajVentCategoria implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @NotNull
    @Column(name = "idbaj_vent_cat")
    private Integer idbajVentCat;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 150)
    @Column(name = "categoria")
    private String categoria;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "bajVentasCategoriaIdbajPlatCat")
    private Collection<BajVentProducto> bajVentProductoCollection;

    public BajVentCategoria() {
    }

    public BajVentCategoria(Integer idbajVentCat) {
        this.idbajVentCat = idbajVentCat;
    }

    public BajVentCategoria(Integer idbajVentCat, String categoria) {
        this.idbajVentCat = idbajVentCat;
        this.categoria = categoria;
    }

    public Integer getIdbajVentCat() {
        return idbajVentCat;
    }

    public void setIdbajVentCat(Integer idbajVentCat) {
        this.idbajVentCat = idbajVentCat;
    }

    public String getCategoria() {
        return categoria;
    }

    public void setCategoria(String categoria) {
        this.categoria = categoria;
    }

    @XmlTransient
    public Collection<BajVentProducto> getBajVentProductoCollection() {
        return bajVentProductoCollection;
    }

    public void setBajVentProductoCollection(Collection<BajVentProducto> bajVentProductoCollection) {
        this.bajVentProductoCollection = bajVentProductoCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idbajVentCat != null ? idbajVentCat.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof BajVentCategoria)) {
            return false;
        }
        BajVentCategoria other = (BajVentCategoria) object;
        if ((this.idbajVentCat == null && other.idbajVentCat != null) || (this.idbajVentCat != null && !this.idbajVentCat.equals(other.idbajVentCat))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "producto.dbentities.BajVentCategoria[ idbajVentCat=" + idbajVentCat + " ]";
    }
    
}
